CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(WinCamera)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

if (MSVC)
    #warning 4251
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4819 /wd4996 ")
	set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DWIN32 /MTd")
	set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /DWIN32 /MT")
	set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:NOREF /OPT:ICF /SAFESEH:NO")
    
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/bin)
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/lib)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/lib)

    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/bin)
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/lib)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/lib)
    
    if (MSVC90)
        add_definitions(-D_BIND_TO_CURRENT_VCLIBS_VERSION=1)
    endif()
    
endif()

set(PROJECT_ROOT ${PROJECT_SOURCE_DIR})
set(RECORDER_DIR ${PROJECT_ROOT}/MediaRecorder)
set(THIRD_PARTY ${RECORDER_DIR}/third_party)
set(COMN_DIR ${RECORDER_DIR}/comn)


if (CMAKE_HOST_WIN32)
    set(LIB_PLATFORM ws2_32 )
	
	SET(DIR_FFMPEG ${THIRD_PARTY}/ffmpeg/x86)
	if(CMAKE_SIZEOF_VOID_P EQUAL 8)
		SET(DIR_FFMPEG ${THIRD_PARTY}/ffmpeg/x64)
	endif()
else()
    set(LIB_PLATFORM pthread rt)
	
	SET(DIR_FFMPEG ${THIRD_PARTY}/ffmpeg/linux)
endif()


ADD_SUBDIRECTORY(WinCamera)
